<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>求成绩</title>
    <script>
        // 1. 输入成绩
        var num = prompt('请输入班级人数');
        var sum = 0;
        for (var i = 1; i <= num; i++) {
            var score = prompt('输入学生的成绩');

            sum += parseFloat(score);
        }
        var average = 0;
        average = sum / num;
        alert('学生的总成绩是' + sum);
        alert('学生的平均成绩是' + average);

        // 2.打印星星
        /*  for (var i = 1; i <= 5; i++) {
             console.log('※');
         } */
        /* 追加字符串
        var str = '';
        for (var i = 1; i <= 5; i++) {
            str = str + '⭐';
        }
        console.log(str); */
    </script>
</head>

<body>

</body>

</html>